NuGet: Fix binding redirect XML parse error to report unparseable file#15147
Merged
Conversation
f8c8550 to
3d1c9ae
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves NuGet binding redirect updates by converting XML parse failures in runtime config files into UnparseableFileException, so the updater reports a dependency_file_not_parseable job error instead of an unknown error.
Changes:
- Catch
System.Xml.XmlExceptionduringapp.config/web.configparsing and rethrow asUnparseableFileExceptionwith the config file path. - Fix typo in the fallback error message (“binging” → “binding”).
- Add a unit test asserting malformed XML triggers
UnparseableFileExceptionwith the expected file path and message.
Show a summary per file
| File | Description |
|---|---|
nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/BindingRedirectManager.cs |
Converts XML parse errors into UnparseableFileException and fixes the binding-redirect error message typo. |
nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/BindingRedirectsTests.cs |
Adds coverage to ensure malformed config XML is surfaced as UnparseableFileException. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 0
sebasgomez238
approved these changes
May 26, 2026
When updating binding redirects, a failure to parse the XML config file was throwing an InvalidOperationException which resulted in an unknown error being reported. This change catches XmlException specifically and throws UnparseableFileException instead, which is properly mapped to the dependency_file_not_parseable error type. Also fixes the typo 'binging' -> 'binding' in the error message. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
3d1c9ae to
ad68784
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When updating binding redirects, a failure to parse the XML config file was throwing an
InvalidOperationExceptionwhich resulted in an unknown error being reported to the API (record_update_job_unknown_error).This change:
XmlExceptionspecifically and throwsUnparseableFileExceptioninstead, which is properly mapped to thedependency_file_not_parseableerror typeTesting: Added a test verifying that malformed XML in a config file produces
UnparseableFileExceptionwith the correct file path and message.